import * as TYPES from "../../Action/bankManage/bankManage.jsx";

const initData = {
	mybankList: [], //我的已绑定的银行卡列表
	userName: "", //用户名
	userRealNo: "", //银行卡账号，
	// userRealInfo:{
	//     userName:'..',  //用户名
	//     userRealNo:'',  //银行卡账号，
	// },  //用户实名信息
	supportedBankList: [] //支持的银行卡列表
};

const bankManageReducer = (state = initData, { type, data }) => {
	switch (type) {
		case TYPES.SET_MY_BANK_LIST:
			return {
				...state,
				mybankList: data
			};
		case TYPES.SET_SUPPORTED_BANK_LIST:
			return {
				...state,
				supportedBankList: data ? (data instanceof Array ? data : []) : []
			};
		case TYPES.SET_USER_REAL_INFO:
			console.log("设置信息", data);
			return {
				...state,
				userName: data.userName,
				userRealNo: data.userRealNo
			};
		default:
			return state;
	}
};

export default bankManageReducer;
